using System;
using System.Collections;
using System.Collections.Generic;

namespace LightCAD.Three
{
    public class HemisphereLightProbe : LightProbe
    {
        #region Properties

        #endregion

        #region constructor
        public HemisphereLightProbe(object skyColor, object groundColor, double intensity = 1)
            : base(null, intensity)
        {
            var color1 = new Color().set(skyColor);
            var color2 = new Color().set(groundColor);
            var sky = new Vector3(color1.r, color1.g, color1.b);
            var ground = new Vector3(color2.r, color2.g, color2.b);
            // without extra factor of PI in the shader, should = 1 / JMath.sqrt( JMath.PI );
            var c0 = JMath.sqrt(JMath.PI);
            var c1 = c0 * JMath.sqrt(0.75);
            this.sh.coefficients[0].copy(sky).add(ground).multiplyScalar(c0);
            this.sh.coefficients[1].copy(sky).sub(ground).multiplyScalar(c1);
        }
        #endregion

    }
}
